package org.nuonuo.sdk.model.callback;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.nuonuo.sdk.jackson.JsonMapper;
import org.nuonuo.sdk.model.base.NMethod;

/**
 * @Version 1.0
 * @Author az
 * @Date 2024-04-15 17:23:07
 * @ClassName Callback
 * @Description 回调
 */
public class Callback {
    /**
     * 接口标识
     */
    private String operater;

    /**
     * 回调内容，json字符串
     */
    private String content;

    public String getOperater() {
        return operater;
    }

    public void setOperater(String operater) {
        this.operater = operater;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    /**
     * 获取回调内容
     *
     * @param <T>
     * @return
     */
    @JsonIgnore
    public <T> T getCallback() {
        return JsonMapper.parse(content, NMethod.getMethod(operater).getClazz());
    }
}
